
function IsNum(str) {
    var value = str;
    if (!(/^(\+|-)?\d+$/.test(value)) || value < 0) {
        return false;
    }
    else {
        return true;
    }
}

function CheckUserLogin() {
    $.get("/ajax.aspx?action=CheckLogin", function (data) {
        var jsonData = eval("(" + data + ")");
        if (jsonData.CheckResult == "1") {
            $(".LoginInfo").html("您好 '" + jsonData.MemberName + "'，欢迎光临居家！<a class='RedWord' href='/Member/Member.aspx'>会员中心</a> | <a class='RedWord' href='/Member/Logout.aspx'>注销</a>");
        }
        else {
            $(".LoginInfo").html("您好，欢迎光临居家！<a class='RedWord' href='/Member/Login.aspx'>登录</a> | <a class='RedWord' href='/Member/Register.aspx'>注册</a>");
        }
    });
}

function AddToFav(pid) {
    $.get("/ajax.aspx?action=AddToFav", { productID: pid }, function (data) {
        var jsonData = eval("(" + data + ")");
        if (jsonData.CheckResult == "1") {
            alert("添加完成。");
        }
        else {
            alert("添加失败。您当前无权进行此类操作。");
        }
    });
}


function CheckSearchBox(object) {
    if (object.value == '') {
        object.value = '输入产品关键字';
    }
    if (object.value == '输入产品关键字') {
        object.value = '';
    }
}
//大图切换
function SetShopPicHTML(ShowPic) {
    document.getElementById("ShowPic").innerHTML = ShowPic;
}
